<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        #box1,#box2,#box3{
            margin: 0px auto;
            border: 1px solid #ccc;
        }

        #box1{
            width: 40%; /*占父容器的宽度的40%*/
            /*height: auto;*/
            height: 120px;
            background: lightblue;
            /*块级元素变成行级元素*/
            /*display: inline;*/
        }

        #box2{
            width: 300px;
            height: 300px;
            background: lightpink;
            /*display: inline;*/
        }

        #box3{
            background: lightgoldenrodyellow;
            /*display: inline;*/
        }
    </style>
</head>
<body>
<h1>块级元素演示案例</h1>
<hr>

<div id="box1">
    DIV1
</div>
<div id="box2">
    DIV2
</div>
<div id="box3">
    DIV3
</div>
</body>
</html>